package com.eunion.core.common.excel;

public class ExcelUtil {

    public static String toExcelColumnIndex(int index) {
        if (index <= 0) {
            throw new IllegalArgumentException();
        }
        StringBuilder s = new StringBuilder();
        do {
            s.insert(0, (char) ('A' + ((index % 26 == 0) ? 25 : (index % 26) - 1)));
            if (index == 26) {
                index = 0;
            } else {
                index = index / 26;
            }
            System.out.println(index);
        } while (index > 0);
        return s.toString();
    }

}
